﻿using Microsoft.Extensions.Caching.Memory;
using OAS.Application.RoleApp.Services;
using OAS.Application.System.Dtos;
using OAS.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OAS.Application.RoleApp
{
    public class RoleController : IDynamicApiController
    {
        private readonly ISqlSugarClient db;
        private readonly IRoleService _roleService;
        public RoleController(IRoleService roleService, ISqlSugarClient db)
        {
            this.db = db;
            _roleService = roleService;
        }
        public async Task<List<Role>> GetAllRole()
        {
            return await _roleService.GetAllRole();
        }
        [HttpPost]
        public async Task<object> GetRoleList(DtoQuery dto)
        {
            return await _roleService.GetRoleList(dto);
        }
        public async Task AddRole(Role role)
        {
            await _roleService.AddRole(role);
        }
        public async Task UpdateRole(Role role)
        {
            await _roleService.UpdateRole(role);
        }
        public async Task DeleteRole([FromBody] string[] ids)
        {
            await _roleService.DeleteRole(ids);
        }
    }
}
